package com.mzm.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Version;

@Entity(name = "BaseEntity")
@Table(name = "BASE_ENTITY")
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@TableGenerator(name = "ID_GEN", table = "ID_GEN", pkColumnName = "GEN_KEY", valueColumnName = "GEN_VALUE", pkColumnValue = "ID", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "ID_GEN")
	protected Integer id;
	
	@Version
	@Column(name = "VER")
	protected int objVer = 0;

	@Column(name = "CREATE_TIME")
	private Date creationTime;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Date getCreationTime() {
		return creationTime;
	}

	public void setCreationTime(Date creationTime) {
		this.creationTime = creationTime;
	}

}
